IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_MasterEventLog_MasterEventLogType]') AND parent_object_id = OBJECT_ID(N'[dbo].[MasterEventLog]'))
BEGIN
     ALTER TABLE [dbo].[MasterEventLog] DROP CONSTRAINT [FK_MasterEventLog_MasterEventLogType]
END
GO

ALTER TABLE [dbo].[MasterEventLog] ADD CONSTRAINT [FK_MasterEventLog_MasterEventLogType] FOREIGN KEY([SrvrInstncDatabaseId], [EventLogTypeId])
     REFERENCES [dbo].[MasterEventLogType] ([SrvrInstncDatabaseId], [EventLogTypeId])
GO
